package hotel.switchs.oversea.online.mapper;


import hotel.base.oversea.repository.MyMapper;
import hotel.switchs.oversea.api.VO.RoomResultVo;
import hotel.switchs.oversea.api.VO.request.GetRoomListVo;
import hotel.switchs.oversea.api.dto.SwitchCreateRoomDto;
import hotel.switchs.oversea.api.dto.SwitchSaleRoomAboutIdsDto;
import hotel.switchs.oversea.api.entity.SwitchCreateRoomEntity;
import hotel.switchs.oversea.api.entity.SwitchCreateRoomInfo;
import hotel.switchs.oversea.api.entity.SwitchHotelActiveTag;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


/**
 * @Author lmf
 * @Date 2020/6/15 19:36
 **/
public interface SwitchCreateRoomMapper extends MyMapper<SwitchCreateRoomEntity> {

    /**
     * 根据子酒店id 和子物理房型id 获取关联的产品列表
     *
     * @param hotelId
     * @param basicRoomTypeId
     * @return
     */
    SwitchCreateRoomEntity selectGoods(@Param("hotelId") int hotelId, @Param("roomId") int basicRoomTypeId);

    /**
     * 根据时间获取可推送价格的房型id
     *
     * @param nowTime
     * @param time
     * @param page
     * @return
     */
    List<RoomResultVo> selectRoomIdByTime(@Param("nowTime") String nowTime, @Param("time") String time, @Param("page") int page);


    /**
     * 根据售卖房型id修改上线状态
     *
     * @param roomId
     */
    int updateByRoomId(@Param("roomId") int roomId, @Param("up") int up);

    /**
     * 分页获取可售卖房型返回ids信息
     *
     * @param map
     * @return
     */
    List<SwitchSaleRoomAboutIdsDto> getMtIdsPageAboutSwitchSaleRoom(Map<String, Integer> map);

    /**
     * 根据售卖房型id 获取美团产品id
     */
    int getMtGoodsId(@Param("roomId") int roomId);


    /**
     * <H1>根据售卖房型ID，获取美团产品信息</H1>
     *
     * @param roomId
     * @return hotel.switchs.oversea.api.dto.SwitchCreateRoomDto
     * @author HuangT
     * @date 2020/7/11 14:13
     */
    SwitchCreateRoomDto getMtInfoBySwitchRoomId(int roomId);

    /**
     * 根据子酒店和子物理房型来判断是否创建过售卖房型
     *
     * @param hotelId
     * @param basicRoomTypeId
     * @param mtGoodsId
     * @return
     */
    SwitchCreateRoomEntity selectByHotelIdAndBasicRoomTypeId(@Param("hotelId") Integer hotelId, @Param("basicRoomTypeId") Integer basicRoomTypeId, @Param("mtGoodsId") String mtGoodsId);

    /**
     * @author: lmf
     * @date: 2020/8/4 19:05
     * 根据子酒店+子房型id 获取美团房型id
     * hotel_id=#{hotelId} and room_type_id=#{roomId}
     */
    SwitchCreateRoomEntity selectMtRoomIdByRoomIdAndHotelId(@Param("hotelId") int hotelId, @Param("roomId") int roomId);

    /**
     * @author: lmf
     * @date: 2020/8/6 18:45
     * 根据美团酒店id+美团产品id
     */
    SwitchCreateRoomEntity selectByMtGoodsIdAndHotelId(@Param("mtHotelId") Integer mtHotelId, @Param("goodId") Integer goodId);

    /**
     * @author: lmf
     * @date: 2020/8/7 17:34
     */
    SwitchCreateRoomEntity selectByRoomIdAndHotelIdAndGoodsID(@Param("hotelId") Integer hotelId, @Param("roomId") int roomTypeId, @Param("mtGoodsId") String mtGoodsId, @Param("mtHotelId") String mtHotelId);

    /**
     * @author: lmf
     * @date: 2020/8/14 13:47
     * 根据美团的酒店id获取子酒店id
     */
    Integer getHotelIdByMtHotelId(@Param("mtHotelId") int mtHotelId);

    /**
     * <H1>获取酒店相关信息</H1>
     *
     * @param hotelIdArr 实体对象
     * @return java.util.List<hotel.switchs.oversea.api.VO.HotelRoomInfoVO>
     * @author HuangT
     * @Date 2020/9/10 17:26
     */
    List<SwitchHotelActiveTag> getHotelRoomInfo(int[] hotelIdArr);
    /**
     * @author: lmf
     * @date: 2020/9/14 14:10
     * 获取子酒店的所有售卖房型列表
     */
    List<SwitchCreateRoomEntity> selectByHotelId(@Param("hotelId") Integer hotelId);

    /**
     * @author: lmf
     * @date: 2020/9/14 14:13
     * 获取售卖房型的信息
     */
    SwitchCreateRoomEntity selectByHotelIdAndRoomId(@Param("hotelId") Integer hotelId, @Param("roomId") Integer roomId);
    /**
     * @author: lmf
     * @date: 2020/9/15 11:39
     * 获取售卖房型列表
     */
    List<SwitchCreateRoomInfo> selectRoomList(GetRoomListVo getRoomListVo);

    /**
     * @author: lmf
     * @date: 2020/9/18 14:07
     * 获取匹配错误的售卖房型id
     */
    List<SwitchCreateRoomEntity> selectMatchError();

    /**
     * @author: lmf
     * @date: 2020/9/18 14:21
     */
    int deleteByHotelIdAndRoomId(@Param("hotelId") int hotelId, @Param("roomId") int roomId);
    /*
     * @author: lmf
     * @date: 2020/9/18 18:35
     */
    int updateNameByRoomId(@Param("hotelId") Integer hotelId, @Param("roomId") int roomTypeId, @Param("roomName") String roomName);
    /**
     * @author: lmf
     * @date: 2020/9/18 19:35
     */
    SwitchCreateRoomEntity selectByRoomIdAndHotelId(@Param("hotelId") Integer hotelId, @Param("roomId") int roomTypeId);
    /***
    * @Author: lmf
    * @Date: 2020/9/24
     * 根据id获取所有的售卖房型列表
    */
    List<SwitchCreateRoomEntity> selectById(List<Integer> list);


    /**
     *
     * @author: lmf
     * @time: 2020/10/13 14:50
     * 根据酒店id获取售卖房型id
     */
    List<SwitchCreateRoomEntity> selectHotelRoomId(@Param("hotelId") Integer hotelId);

    /**
     * 获取已经上架的美团酒店id
     * @return
     */
    List<Integer> selectMtHotelId();
    /**
     *
     * @author: lmf
     * @time: 2020/10/28 17:01
     * 获取酒店的所有售卖房型id
     */
    List<SwitchCreateRoomEntity> selectRoomIdByMtHotelId(Integer hotelId);

    /**
    *@Description: 获取已经创建的携程美团酒店以及产品id
    *@Author: Zhang·jz
    *@date: 2020/10/21
    */
    List<SwitchCreateRoomEntity> selectAllHotelRoomId();

    /**
     * 根据售卖房型id更新售卖房型名称
     * @param roomName
     * @param hotelId
     * @param roomTypeId
     * @return
     */
    Integer updateRoomNameByRoomId(@Param("roomName") String roomName, @Param("hotelId") Integer hotelId, @Param("roomTypeId") int roomTypeId);
    /**
     *
     * @author: lmf
     * @time: 2020/10/28 14:02
     * 根据美团酒店id+美团房型id+美团产品id 获取携程产品信息
     */
    SwitchCreateRoomEntity selectRoomInfoByMtHotelIdAndMtHotelRoomIdAndMtGoodId(@Param("mtHotelId") Integer mtHotelId, @Param("mtRoomId") Integer mtRoomId, @Param("mtGoodId") Integer mtGoodId);
    /**
     *
     * @author: lmf
     * @time: 2020/10/28 14:02
     * 根据美团酒店id+美团房型id+美团产品id 删除携程产品信息
     */
    Integer deleteRoomInfoByMtHotelIdAndMtHotelRoomIdAndMtGoodId(@Param("mtHotelId") Integer mtHotelId, @Param("mtRoomId") Integer mtRoomId, @Param("mtGoodId") Integer mtGoodId);
    /**
     * @author: lmf
     * @time: 2020/10/29 17:44
     * 根据美团酒店id+美团的房型id
     */
    SwitchCreateRoomEntity selectMtHotelIdAndMtRoomId(@Param("mtHotelId") int mtHotelId, @Param("mtRoomId") int mtRoomId);

    /**
     * 根据美团的id 获取携程的酒店id
     * @param mtHotelId
     * @return
     */
    Integer selectHotelIdByMtHotelId(@Param("mtHotelId") String mtHotelId);

    Integer deleteRoomInfoByMtHotelIdAndMtGoodId(int mtHotelId, String goodId);

    /**
     * 根据携程酒店id 获取美团的酒店id
     * @param hotelId
     * @return
     */
    Integer selectMtHotelIdBySwitchHotelId(@Param("hotelId") int hotelId);
    /***
     * @Author: lmf
     * @Date: 2020/9/30
     * 获取上架酒店的所有售卖房型id
     */
    List<SwitchCreateRoomEntity> selectUpHotelRoomIds();
    /**
     * @Author: lmf
     * @Date: 2020-11-18
     * 获取非上架酒店的所有售卖房型id
     */
    List<SwitchCreateRoomEntity> selectNoUpHotelRoomIds();

    /**
     * 根据美团酒店id+美团的房型id
     * @param mtHotelId
     * @param mtRoomId
     * @return
     */
    List<SwitchCreateRoomEntity> selectRoomInfoByMtHotelIdAndMtHotelRoomId(@Param("mtHotelId") int mtHotelId, @Param("mtRoomId") Integer mtRoomId);

    /**
     * 根据美团的房型id 根据美团的酒店id 美团的产品id清除数据
     * @param mtHotelId
     * @param mtRoomId
     * @param mtGoodId
     * @return
     */
    Integer deleteRoomInfoByMtHotelIdAndMtRoomIdAndMtGoodId(@Param("mtHotelId") int mtHotelId, @Param("mtRoomId") Integer mtRoomId, @Param("mtGoodId") String mtGoodId);

    List<SwitchCreateRoomEntity> selectAllData();
    /***
    * @Author: lmf
    * @Date: 2020/12/7
    */
    List<SwitchCreateRoomEntity> selectHotelUpStatus(@Param("genre") Integer genre);
    /***
    * @Author: lmf
    * @Date: 2021/1/7
     * 获取美团的酒店id
    */
    Integer selectMtHotelIdByHotelId(@Param("hotelId") Integer hotelId);
    /****
    * @Author: lmf
    * @Date: 2021/2/2
     * 获取携程的售卖房型id
    */
    List<Integer> selectRoomIdByHotelId(Integer hotelId);
    /***
    * @Author: lmf
    * @Date: 2021/2/3
     * 根据母物理房型id获取产品列表数据
    */
    List<SwitchCreateRoomEntity> selectByMasterBasicRoomId(@Param("masterBasicRoomId") Integer masterBasicRoomId);

    /***
     * @Author: lmf
     * @Date: 2021/4/8
     * 根据美团的酒店获取产品列表
     */
    List<SwitchCreateRoomEntity> selectByMtHotelId(@Param("mtHotelId") Integer mtHotelId);
    /***
     * @Author: lmf
     * @Date: 2021/4/9
     * 获取美团酒店列表
     */
    List<Integer> selectSaleHotelList();

    /***
     * @Author: lmf
     * @Date: 2021/4/14
     * 获取美团的酒店id和美团房型id
     */
    SwitchCreateRoomEntity selectMtHotelIdAndMtRoomIdByHotelId(@Param("hotelId") Integer hotelId, @Param("roomTypeId") int roomTypeId);
    /**
     * 根据酒店ID获取售卖房型Id
     * @param hotelId
     * @return
     */
    List<Integer> selectRoomTypeList(Integer hotelId);
}
